package 富婆梦.第一阶段.第三周.练习题;

import java.util.Random;

public class SimpleDotComGame {
    public static void main(String[] args) {
        int numOfGuess = 0;
        GameHelper1 helper = new GameHelper1();
        SimpleDotCom dot = new SimpleDotCom();

        //用随机数产生第一格的位置，然后制作数组
        int randomNum = new Random().nextInt(5);
        int[] location = {randomNum, randomNum + 1, randomNum + 2};
        dot.setLocationCell(location);

        //用于记录游戏是否继续进行
        boolean isAlive = true;

        while (isAlive == true) {
            String guss = helper.getUserInput("enter a number");
            String result = dot.checkyoursel(guss);
            numOfGuess++;
            System.out.println(result);
            if (result == "sunk") {
                isAlive = false;
                System.out.println("You took " + numOfGuess + " guesses");
            }
        }

    }
}
